﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using IronOne.SalesOne.BusinessObjects;
using Facade;

using System.Data;

namespace IronOne.SalesOne.SalesOneWeb.Structure
{
    public partial class ManageUnits : System.Web.UI.Page
    {
        public List<SalesOneUnit> unitList;
        protected void Page_Load(object sender, EventArgs e)
        {
            lblHeader1.Text = "Manage Unit";



            //UCGrid1.SetDataSource(DataSource1());

            /*
            if (!IsPostBack)
            {
                DataSource();

                DataSet ds=new DataSet();
                DataTable dt=new DataTable();
                dt.Columns.Add("Unit ID");
                dt.Columns.Add("Unit Code");
                dt.Columns.Add("Unit Name");
                dt.Columns.Add("Effective From");
                dt.Columns.Add("Effective To");


                for (int x = 0; x <unitList.Count ; x++)
                {
                    dt.Rows.Add();
                    dt.Rows[x][0] = unitList[x].UnitId;
                    dt.Rows[x][1] = unitList[x].Code;
                    dt.Rows[x][2] = unitList[x].Name;
                    dt.Rows[x][3] = unitList[x].From ;
                    dt.Rows[x][4] = unitList[x].To ;

                }
                ds.Tables.Add(dt);
                UCGrid1.SetDataSource(ds);
               
            }
             * 
             * */

            //UCGrid1
             
             
        }
        
             private List<SalesOneUnit> DataSource()
        {

                 DataTable untTable=new DataTable();
                 StructureFacade unt=new StructureFacade();
                 unitList=unt.GetUnits("UnitID ASC");

                 return unitList;
        }
             private List<SalesOneUnit> DataSource1()
             {

                 
                 StructureFacade unt = new StructureFacade();
                 unitList = unt.GetUnitsForBranch(36);

                 return unitList;
             }


        }
    }

